package org.example.ioc.pro1;

import org.example.ioc.pro1.bean.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class App2 {
    public static void main(String[] args) {
        //1.基于类路径的xml配置文件  创建容器
        //ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");

        //2. 基于文件系统路径的 XML 配置文件创建容器
        // 指定 XML 文件的完整路径(绝对路径)
        //ApplicationContext context = new FileSystemXmlApplicationContext("D:\\Users\\zoe\\Ideaproject\\mavenTest153\\cls153-spring1base\\src\\main\\resources\\beans.xml");


        //3. 基于注解的配置文件创建容器
        ApplicationContext context = new AnnotationConfigApplicationContext(Student.class);

        Student stu = (Student) context.getBean("s", Student.class);
        System.out.println(stu);

    }
}
